package com.nbgs.demo.dao;

import com.nbgs.demo.info.StageInfo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface UpdateConsumptionInfoMapper {

    @Update("update t_consumption set consumption_end = #{consumptionEnd} where consumption_id = #{consumptionId}")
    void updateConsumptionEnd(@Param("consumptionId") int consumptionId,@Param("consumptionEnd") double consumptionEnd);


    @Select("select stage_id,stage_scope from t_stage_scope " +
            "join t_type on t_type.type_id = t_stage_scope.type_id " +
            "where t_type.type =#{type} " +
            "order by stage_scope ASC")
    List<StageInfo> selectAllScopeInfo(String type);

    @Select("select price from t_water_price join t_stage_scope  " +
            "on t_water_price.stage_id = t_stage_scope.stage_id  " +
            "where t_stage_scope.stage_id = #{stageId}")
    double selectCurrentScopeWaterPrice(int stageId);

    @Update("update t_waterbill set payable = #{payable} where consumption_id = #{consumptionId}")
    void updatePayable(@Param("consumptionId") int consumptionId,@Param("payable") Double payable);
}
